<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang"ja" lang="ja">
<head>
    <title>作業時間管理 on GAE | CSV出力</title>
    <link type="text/css" rel="stylesheet" href="/stylesheets/default.css"/>
    <link type="text/css" rel="stylesheet" href="/stylesheets/alert.css"/>
    <link type="text/css" rel="stylesheet" href="/stylesheets/alphacube.css"/>    
    <script type="text/javascript" src="/scripts/prototype.js"> </script>
    <script type="text/javascript" src="/scripts/effects.js"> </script>
    <script type="text/javascript" src="/scripts/window.js"> </script>
    <script type="text/javascript" src="/scripts/window_effects.js"> </script>
    <script type="text/javascript" src="/scripts/debug.js"> </script>
	<!-- mfkd libraly //-->
    <link type="text/css" rel="stylesheet" href="/stylesheets/workingtimeinput.css" />
	<script type="text/javascript" src="/scripts/mfkd.js"></script>
	<script type="text/javascript">
		window.onload = function() {
			Focus.Index = {	year_from:"month_from",
						    month_from:"day_from",
						    day_from:"year_to",
						    year_to:"month_to",
						    month_to:"day_to",
						    day_to:"enter"};
		    //
		    $("year_from").onfocus    = function() { Focus.GotFocus(this);};
		    $("year_from").onblur     = function() { Focus.LostFocus(this); };
		    $("year_from").focus();
		    //
		    $("month_from").onfocus    = function() { Focus.GotFocus(this);};
		    $("month_from").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("day_from").onfocus    = function() { Focus.GotFocus(this);};
		    $("day_from").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("year_to").onfocus    = function() { Focus.GotFocus(this);};
		    $("year_to").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("month_to").onfocus    = function() { Focus.GotFocus(this);};
		    $("month_to").onblur     = function() { Focus.LostFocus(this); };
		    //
		    $("day_to").onfocus    = function() { Focus.GotFocus(this);};
		    $("day_to").onblur     = function() { Focus.LostFocus(this); };
		}
		function keypress(event, id) {
	        // ｷｰの取得
	        if (event.keyCode != 0) { key = event.keyCode; }
	        else { key = event.charCode; }

	        if (id == "year_from") { Validator.Validation($(id), key, {"NotEmpty":"","Range":[2010,2019]}); };
	        if (id == "month_from") { Validator.Validation($(id), key, {"NotEmpty":"","Range":[1,12]}); };
			if (id == "day_from") { Validator.Validation($(id), key, {"NotEmpty":"","Range":[1,31]}); };
			if (id == "year_to") { Validator.Validation($(id), key, {"NotEmpty":"","Range":[2010,2019]}); };
			if (id == "month_to") { Validator.Validation($(id), key, {"NotEmpty":"","Range":[1,12]}); };
	        if (id == "day_to") { Validator.Validation($(id), key, {"NotEmpty":"","Range":[1,31]}); };
		};
		function check() {
			var err = "";

			err = Validator.NotEmpty($("year_from").value);
			if (err != "") {
				Validator.ShowAlert($("year_from"), err);
				return false;
			};
			err = Validator.Range($("year_from").value, 2010, 2019);
			if (err != "") {
				Validator.ShowAlert($("year_from"), err);
				return false;
			};
			
			err = Validator.NotEmpty($("month_from").value);
			if (err != "") {
				Validator.ShowAlert($("month_from"), err);
				return false;
			};
			err = Validator.Range($("month_from").value, 1, 12);
			if (err != "") {
				Validator.ShowAlert($("month_from"), err);
				return false;
			};

			err = Validator.NotEmpty($("day_from").value);
			if (err != "") {
				Validator.ShowAlert($("day_from"), err);
				return false;
			};
			err = Validator.Range($("day_from").value, 1, 31);
			if (err != "") {
				Validator.ShowAlert($("day_from"), err);
				return false;
			};

			err = Validator.NotEmpty($("year_to").value);
			if (err != "") {
				Validator.ShowAlert($("year_to"), err);
				return false;
			};
			err = Validator.Range($("year_to").value, 2010, 2019);
			if (err != "") {
				Validator.ShowAlert($("year_to"), err);
				return false;
			};

			err = Validator.NotEmpty($("month_to").value);
			if (err != "") {
				Validator.ShowAlert($("month_to"), err);
				return false;
			};
			err = Validator.Range($("month_to").value, 1, 12);
			if (err != "") {
				Validator.ShowAlert($("month_to"), err);
				return false;
			};

			err = Validator.NotEmpty($("day_to").value);
			if (err != "") {
				Validator.ShowAlert($("day_to"), err);
				return false;
			};
			err = Validator.Range($("day_to").value, 1, 31);
			if (err != "") {
				Validator.ShowAlert($("day_to"), err);
				return false;
			};

			document.myform.submit();
		}		
	
	</script> 	    
</head>
<body>
	<!-- メニュー -->
	<div class="menu">
		<ul>
			<li>&nbsp;</li>
		</ul>	
	</div>
    <!-- コンテンツ -->
	<div class="contents">
		<p class="title">CSV出力</p>
	    <form name="myform" action="/Download.csv" method="get">
	    	<table>
				<tr class="header">
					<th>開始年月日</th>
	    			<th>
					</th>
					<th>終了年月日</th>
				</tr>
	    		<tr>
	    			<td>
						<input type="text" id="year_from" name="year_from" size="4" maxlength="4" value="{{ fromyear_str }}" onkeypress="keypress(event, 'year_from');" />
				        <span>/</span>
				        <input type="text" id="month_from" name="month_from" size="2" maxlength="2" value="{{ frommonth_str }}" onkeypress="keypress(event, 'month_from');" />
				        <span>/</span>
				        <input type="text" id="day_from" name="day_from" size="2" maxlength="2" value="{{ fromdate_str }}" onkeypress="keypress(event, 'day_from');" />
					</td>
					<td>
				        <span>〜</span>		
	    			</td>
	    			<td>
				        <input type="text" id="year_to" name="year_to" size="4" maxlength="4" value="{{ toyear_str }}" onkeypress="keypress(event, 'year_to');" />
				        <span>/</span>
				        <input type="text" id="month_to" name="month_to" size="2" maxlength="2" value="{{ tomonth_str }}" onkeypress="keypress(event, 'month_to');" />
				        <span>/</span>
				        <input type="text" id="day_to" name="day_to" size="2" maxlength="2" value="{{ todate_str }}" onkeypress="keypress(event, 'day_to');" />
	    			</td>				
				</tr>
			</table>
	        <br />	        
	        <input type="button" id="enter" onclick="check()" value="実行"/><input type="reset" id="reset" value="リセット"/>
	        <input type="hidden" name="date" value="{{ backmonth_str }}"/>
	    </form>
	</div>
</body>
</html>
</body>
</html>